import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import About from '../views/About.vue'
import NavSidebar from '../views/NavSideBar.vue'
import LeftSidebar from '../views/LeftSideBar.vue'
import RightSidebar from '../views/RightSideBar.vue'
import Lifecycle from '../views/Lifecycle.vue'
import Example from '../views/Example.vue'
import Routeguard from '../views/Routeguard.vue'
// 在 Vue-router新版本中，需要使用createRouter来创建路由
export default createRouter({
    // 指定路由的模式,此处使用的是hash模式
    history: createWebHashHistory(),
    // 路由地址
    routes: [
        { 
            path: '/', components: {
                default:Home,
                NavSidebar,
                LeftSidebar,
                RightSidebar,
            },meta:{
                name:'首页'
            }
        },
        { 
            path: '/example', components: {
                default:Example,
                NavSidebar,
                LeftSidebar,
                RightSidebar,
            },meta:{
                name:'示例'
            }
        },
        { 
            path: '/lifecycle', components: {
                default:Lifecycle,
                NavSidebar,
                LeftSidebar,
                RightSidebar,
            },meta:{
                name:'生命周期'
            }
        },
        { 
            path: '/routeguard', components: {
                default:Routeguard,
                NavSidebar,
                LeftSidebar,
                RightSidebar,
            },meta:{
                name:'路由守卫'
            }
        },
        { 
            path: '/about', components: {
                default:About,
                NavSidebar,
                LeftSidebar,
                RightSidebar,
            },meta:{
                name:'关于'
            }
        },
    ]
})
